const Router = require('@koa/router');
const fun = require('../controller/system/dict.controller');
const config = require('../config');

const router = new Router({ prefix: `${config.ADMIN_PREFIX}` });

const str_type = '/sys-dict-type';
const str_dict = '/sys-dict';
/**
 * 字典类型接口
 */
// 创建字典类型
router.post(str_type, fun.createType);

// 获取字典类型列表
router.get(str_type, fun.listTypes);

// 更新字典类型
router.put(str_type, fun.updateType);

// 删除字典类型
router.delete(str_type, fun.deleteType);

/**
 * 字典数据接口
 */

router.post(str_dict, fun.createDict); // 创建字典值
router.get(str_dict, fun.listDicts); // 获取字典值列表
router.put(str_dict, fun.updateDict); // 更新字典值
router.delete(str_dict, fun.deleteDict); // 删除字典值
router.get(`${str_dict}/dict`, fun.getAllDicts); // 获取所有字典值
module.exports = router;
